package com.example.myprojectoffeixue;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;

public class MaKulistActivity extends Activity {

    private ListView mK;
    private Mkadapter m1;
    private MyApplication m;

    Handler hand = new Handler() {

        public void handleMessage(android.os.Message msg) {

            if (msg.what == 1) {
                m1.notifyDataSetChanged();
            }
        }

        ;
    };


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_ma_kulist);
        info();
    }

    private void info() {
        m = (MyApplication) getApplication();
        m.hand = hand;
        mK = (ListView) findViewById(R.id.lv_MK);
        m1 = new Mkadapter(m.MK, this);
        mK.setAdapter(m1);
        mK.setOnItemClickListener(new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                if ("04".equals(m.type)) {
                    Intent it = new Intent(getBaseContext(), StudyYaoKongQiActivity.class);
                    it.putExtra("num", m.MK.get(position));
                    startActivity(it);

                } else if ("02".equals(m.type)) {

                    Intent it = new Intent(getBaseContext(), StudyjdhActivity.class);

                    it.putExtra("num", m.MK.get(position));
                    startActivity(it);


                } else if ("06".equals(m.type)) {
                    Intent it = new Intent(getBaseContext(), StudyKTActivity.class);
                    it.putExtra("num", m.MK.get(position));
                    startActivity(it);


                }
            }


        });

    }


}
